package com.yuke.cloud.service.api.wmc.service;


import com.github.pagehelper.PageInfo;
import com.yuke.cloud.common.security.feign.OAuth2FeignAutoConfiguration;
import com.yuke.cloud.common.util.wrapper.Wrapper;
import com.yuke.cloud.service.api.pmc.dto.ProdSpecInfoExDto;
import com.yuke.cloud.service.api.smc.dto.SmcShopDto;
import com.yuke.cloud.service.api.wmc.dto.*;
import com.yuke.cloud.service.api.wmc.service.hystrix.WmcStorageFeignApiHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "yuke-cloud-service-wmc", configuration = OAuth2FeignAutoConfiguration.class,
        fallback = WmcStorageFeignApiHystrix.class, path = "${yuke.feign-path-wmc}")
public interface WmcStorageFeignApi {
    @RequestMapping(value = "/wmc/api/getStorageNum", method = RequestMethod.POST)
    List<StorageDto> getStorageNum(@RequestBody List<StorageDto> dto);

    @GetMapping(value = "/wmc/api/getshopidbywarehousename")
    List<Long> getshopidbywarehousename(@RequestParam("warehouseId") Long warehouseId);

    @RequestMapping(value = "/wmc/api/getwarehousenamebyshopid", method = RequestMethod.POST)
    List<Map> getWarehouseName(@RequestBody List<Long> shopids);


    @RequestMapping(value = "/wmc/api/getassreturn", method = RequestMethod.POST)
    Wrapper<PageInfo<Map>> getassreturn(@RequestBody Map map);

    @RequestMapping(value = "/wmc/api/getassreturn2", method = RequestMethod.POST)
    Wrapper<PageInfo<Map>> getassreturn2(@RequestBody Map map);

    @RequestMapping(value = "/wmc/api/getassreturn3", method = RequestMethod.POST)
    Wrapper<PageInfo<Map>> getassreturn3(@RequestBody Map map);


    @RequestMapping(value = "/wmc/api/getlogistics", method = RequestMethod.POST)
    Object getlogistics(@RequestBody Map map) throws Exception;

    @RequestMapping(value = "/wmc/api/getwarehouseinfo", method = RequestMethod.POST)
    Long getwarehouseinfo(@RequestParam("shopid") Long shopid);


    @RequestMapping(value = "/wmc/api/preadd", method = RequestMethod.POST)
    Wrapper preadd(@RequestParam("name") String name);

    @RequestMapping(value = "/api/wmc/warehouse/getwarehouseidbyshopid", method = RequestMethod.POST)
    Wrapper getwarehouseidbyshopid(@RequestParam("shopid") Long name1);

    @GetMapping(value = "/wmc/api/ifexits")
    boolean ifexits(@RequestParam("orderId") Long orderId);

    @RequestMapping(value = "/wmc/api/preadd2", method = RequestMethod.POST)
    Wrapper preadd2(@RequestParam("name") String ss);

    @GetMapping(value = "/wmc/api/getrefundamound")
    Integer getrefundamound(@RequestParam("orderId") Long orderId);

    @RequestMapping(value = "/wmc/api/preadd3", method = RequestMethod.POST)
    void preadd3(@RequestParam("name") String sz);

    @RequestMapping(value = "/wmc/api/getinfo", method = RequestMethod.GET)
    int assessinfo(@RequestParam("orderId") Long orderId);

    /**
     * 获取同一个城市仓库中指定商品的库存量
     * @param regionCityId
     * @return
     */
    @RequestMapping(value = "/wmc/api/cityStockCount", method = RequestMethod.POST)
    Wrapper<Map<Long, Integer>> getCityStockCount(@RequestParam("regionCityId") Long regionCityId, @RequestBody List<Long> specIds);

    /**
     * 获取同一个城市可卖商品数量
     * @param regionCityId
     * @return
     */
    @RequestMapping(value = "/wmc/api/cityAllStockCount", method = RequestMethod.GET)
    Wrapper<Map<Long, Integer>> getCityAllStockCount(@RequestParam("regionCityId") Long regionCityId);

    /**
     * 获取远程仓库可卖商品数量及仓库信息
     * @param localWarehouseId
     * @return
     */
    @RequestMapping(value = "/wmc/api/remoteStock", method = RequestMethod.POST)
    Wrapper<List<WareProductDto>> getRemoteStock(@RequestBody List<Long> specIds, @RequestParam("localWarehouseId") Long localWarehouseId);

    /**
     * 获取指定仓库中指定商品的库存量
     * @param warehouseId
     * @return
     */
    @RequestMapping(value = "/wmc/api/warehouseStockCount", method = RequestMethod.POST)
    Wrapper<Map<Long, Integer>> getWarehouseStockCount(@RequestParam("warehouseId") Long warehouseId, @RequestBody List<Long> specIds);

    /**
     * 根据仓库ID获取仓库名称等信息
     * @param warehouseIds
     * @return
     */
    @RequestMapping(value = "/api/wmc/warehouse/getWarehouseInfo", method = RequestMethod.POST)
    Wrapper<List<WarehouseInfoDto>> getWarehouseInfo(@RequestBody List<Long> warehouseIds);

    @RequestMapping(value = "/api/wmc/warehouse/getStorageInfo", method = RequestMethod.POST)
    List<StorageDto> getStorageInfo();

    @RequestMapping(value = "/api/wmc/warehouse/updateStorageNum", method = RequestMethod.POST)
    Wrapper updateStorageNum(@RequestBody List<StorageDto> storageDtos);

    @RequestMapping(value = "/api/wmc/warehouse/getWarehouseInfoByGroupId", method = RequestMethod.POST)
    List<WarehouseInfoDto> getWarehouseInfoByGroupId(@RequestParam("groupId") Long groupId);

    @RequestMapping(value = "/api/wmc/warehouse/getStorageInfoByCategoryIds", method = RequestMethod.POST)
    List<StorageSpecInfoDto> getStorageInfoByCategoryIds(@RequestBody List<Long> categoryIds,@RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/api/wmc/warehouse/getStorageInfoByCondition", method = RequestMethod.POST)
    List<StorageSpecInfoDto> getStorageInfoByCondition(@RequestBody StorageSpecInfoDto storageSpecInfoDto, @RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/api/wmc/warehouse/getStorageInfoBySpecIds", method = RequestMethod.POST)
    List<StorageSpecInfoDto> getStorageInfoBySpecIds(@RequestBody List<Long> specIds,@RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/api/wmc/warehouse/getStorageInfos", method = RequestMethod.POST)
    StorageDto getStorageInfos(@RequestParam("specId") Long specId);

    @RequestMapping(value = "/api/wmc/warehouse/getStorageSpecBySpecIds", method = RequestMethod.POST)
    List<ProdSpecInfoExDto> getStorageSpecBySpecIds(@RequestParam("shopId") Long shopId, @RequestBody List<Long> specIds, @RequestParam("cartType") Byte cartType);

    @RequestMapping(value = "/api/wmc/warehouse/getProdStorageSpecBySpecIds", method = RequestMethod.POST)
    List<StorageSpecInfoDto> getProdStorageSpecBySpecIds(@RequestBody List<Long> specIds,@RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/api/wmc/warehouse/getInfoWarehouseIds", method = RequestMethod.POST)
    Wrapper<List<WareProductDto>> getInfoWarehouseIds(@RequestBody List<Long> specIds);

    @RequestMapping(value = "/api/wmc/warehouse/bindWarehouseShop", method = RequestMethod.POST)
    int bindWarehouseShop(@RequestBody SmcShopDto smcShopDto);

    @RequestMapping(value = "/api/wmc/warehouse/getGiftList", method = RequestMethod.POST)
    List<WmsGiftDto> getGiftList(@RequestBody WmsGiftDto wmsGiftDto);

    @RequestMapping(value = "/api/wmc/warehouse/updateWmsGift", method = RequestMethod.POST)
    Integer updateWmsGift(@RequestBody WmsGiftDto wmsGiftDto);

    @RequestMapping(value = "/api/wmc/warehouse/getProdSpecInfo" , method = RequestMethod.POST)
    List<StorageSpecInfoDto> getProdSpecInfo(@RequestBody List<Long> specIds);

    @RequestMapping(value = "/wmc/api/warehouse/getGroupIdByShopId", method = RequestMethod.POST)
    Wrapper<Long> getGroupIdByShopId(@RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/wmc/api/getStorageSpecByStorageIds", method = RequestMethod.POST)
    List<ProdSpecInfoExDto> getStorageSpecByStorageIds(@RequestBody List<Long> storageIds, @RequestParam("cartType") Byte cartType);

    @RequestMapping(value = "/wmc/api/getWmsSpecInfoBySpecIds", method = RequestMethod.POST)
    List<StorageSpecInfoDto> getWmsSpecInfoBySpecIds(@RequestBody List<Long> specIds, @RequestParam(value="shopId",required = false,defaultValue = "6") Long shopId);

    @RequestMapping(value = "/api/wmc/warehouse/getAllStorageInfoBySpecIds", method = RequestMethod.POST)
    List<StorageSpecInfoDto> getAllStorageInfoBySpecIds(@RequestBody List<Long> specIds,@RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/api/wmc/warehouse/getAllStorageBySpecIds", method = RequestMethod.POST)
    List<StorageSpecInfoDto> getAllStorageBySpecIds(@RequestBody List<Long> specIds,@RequestParam("warehouseId") Long warehouseId);

    @RequestMapping(value = "/api/wmc/warehouse/findByPostion", method = RequestMethod.POST)
    List<Map> findByPostion(@RequestParam("latitude") Double latitude, @RequestParam("longitude") Double longitude,@RequestParam("distance") Long distance);

    @RequestMapping(value = "/api/wmc/warehouse/getBrandsByCategorys", method = RequestMethod.POST)
    List<Long>  getBrandsByCategorys(@RequestBody List<Long> prodCategories,@RequestParam("specName") String specName,@RequestParam("saleType") Byte saleType,@RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/api/wmc/getStorageInfoByStorageIds", method = RequestMethod.POST)
    List<StorageDto> getStorageInfoByStorageIds (@RequestBody List<Long> storageIds);

    @RequestMapping(value = "/api/wmc/getAllWarehouse", method = RequestMethod.POST)
    Wrapper<List<WarehouseInfoDto>> getAllWarehouse (@RequestParam(name="warehouseName",required = false) String warehouseName,
                                      @RequestParam(name="wareType",required = false) String wareType);

    @RequestMapping(value = "/api/wmc/selectWmsSpecsByProductId", method = RequestMethod.POST)
    Wrapper<List<StorageDto>> selectWmsSpecsByProductId(@RequestBody StorageDto storageDto);

    @RequestMapping(value = "/api/wmc/saveWarehouse", method = RequestMethod.POST)
    WarehouseInfoDto saveWarehouse(@RequestBody WarehouseInfoDto warehouseInfoDto);

    @RequestMapping(value = "/api/wmc/saveWarehouseGroup", method = RequestMethod.POST)
    Wrapper saveWarehouseGroup(@RequestParam("groupId") Long groupId,@RequestParam("warehouseId") Long warehouseId);

    @RequestMapping(value = "/api/wmc/saveWarehouseShop", method = RequestMethod.POST)
    Wrapper saveWarehouseShop(@RequestParam("warehouseId") Long warehouseId, @RequestParam("shopId") Long shopId);

    @RequestMapping(value = "/api/wmc/findOrderFlow", method = RequestMethod.POST)
    List<WmsFlowApiDto> findOrderFlow(@RequestBody List<Long> collect);


}
